<template>
  <div id="app">
    <img src="./assets/logo.png">
    <router-view/>
  </div>
</template>

<script>
export default {
  name: 'App',
  created () {
    // fetch
    // fetch('/api/test/testToken.php', {
    //   method: 'post',
    //   headers: {
    //     token: 'f4c902c9ae5a2a9d8f84868ad064e706'
    //   },
    //   body: JSON.stringify({
    //     username: "name",
    //     password: "pwd"
    //   })
    // }).then(result => {
    //   // 数据流转JSON
    //   return result.json()
    // }).then(data => {
    //   console.log(data)
    // })

    // axios
    this.$axios.post('/api/test/testToken.php', {
    // axios.post('/api/test/testToken.php', {
      username:"name", 
      password:"pwd"
    }).then(res => {
      console.log(res)
    }).catch(error => {
      console.log(error)
    })
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
